cmake_minimum_required(VERSION 3.5)

project(qt.examples VERSION 0.1 LANGUAGES CXX)

include(cmake/SparkWithGit.cmake)
spark_initialize_modules()

# 控制 qDebug 行为
if(CMAKE_BUILD_TYPE MATCHES "Release")
    add_compile_definitions(QT_NO_WARNING_OUTPUT=1 QT_NO_DEBUG_OUTPUT=1)
else()
#    add_compile_definitions(DEBUG_REPO="${CMAKE_SOURCE_DIR}")
    add_compile_definitions(DEBUG_FONT_DIR="${CMAKE_SOURCE_DIR}/font")
endif(CMAKE_BUILD_TYPE MATCHES "Release")

spark_add_links_qt5(DBus)
spark_add_target_realpaths(_
    s:utils/LogUtils
    s:utils/FileSize
    s:category/dbus/DHelloWorld+LogUtils

    # core
    t:category/base/core-helloworld
    t:category/base/core-json-test
    t:category/base/core-variant-test
    
    # dbus
    t:category/dbus/base-connect-dbus+DHelloWorld
    # 服务注册/调用
    t:category/dbus/helloworld-dbus-service-register+DHelloWorld
    t:category/dbus/helloworld-dbus-service-call+DHelloWorld
    # 信号监听
    s:category/dbus/helloworld-dbus-service-subscribe-signal/IDHelloWorld+LogUtils
    t:category/dbus/helloworld-dbus-service-subscribe-signal+IDHelloWorld

    # other
    t:category/other/utils-filesize-test+LogUtils+FileSize
    t:category/other/utils-log-helloworld+LogUtils
    #t:category/other/other-systemtrayicon
)
target_link_qt_dbus(DHelloWorld)
target_link_qt_dbus(IDHelloWorld)

spark_add_executable_path(other-systemtrayicon
    category/other/other-systemtrayicon
    category/other/other-systemtrayicon/res/res.qrc
)
target_link_qt(other-systemtrayicon)

spark_framework_include_with_git(other-systemtrayicon
    https://gitee.com/spark-framework-libs/spark-framework-features
    FEATURES screenutil
)

# 示例集合
option(ENABLE_BUILD_EXAMPLES "Enable Build Examples." OFF)
if(ENABLE_BUILD_EXAMPLES)
    include(examples/dev.cmake)
endif(ENABLE_BUILD_EXAMPLES)

# 测试集合
option(ENABLE_BUILD_TESTS "Enable Build Tests." OFF)
if(ENABLE_BUILD_TESTS)
    add_subdirectory(tests)
endif(ENABLE_BUILD_TESTS)
